$(function(){
		$('.message li').hover(function(){
			$(this).addClass("ac");
		},
		function(){
			$(this).removeClass("ac");
		}
		);
	});
	var s_widget = document.getElementById("s_widget");
	s_widget.onfocus = function(){
		if (this.value == "找人") {
		this.value = "";
		this.style.color = "#333";
		}
	}
	s_widget.onblur = function(){
		if(this.value == ""){
		this.value = "找人";
		this.style.color = "#999";
		}
	}
	 function charCodeAbout(str) {
            var sum = 0;
            for (var i = 0; i < str.length; i++) {
                strCode = str.charCodeAt(i);
                if (strCode <= 126 && strCode >= 32) {
                    sum++;
                }
                else { sum += 2; }
            }
            return sum;
        }
	 function countTxt(a, b) {
	    var limitedWord = 140;
        var t = this;
        total();
        a.bind(($.browser.msie ? 'propertychange' || 'keyup' : 'input'), function () {
            total();
        });
        function total() {
            var strNo = charCodeAbout($.trim(a.val()));
            var wordNo = Math.ceil(strNo / 2);
            wordNo <= limitedWord ? b.html('请文明发言，还可以输入<em>' + (limitedWord - wordNo) + '</em>字') : b.html('超出<em class="error">' + (wordNo - limitedWord) + '</em>字');
        }
    }
	$('.talk_pannel .controlbar .pl').unbind('click').click(function () {//评论
            var msgBox = $(this).parents('.msgbox');
            var noteId = $(this).attr("noteId");
            if (msgBox.find('.commentPannel')[0]) {
                msgBox.find('.inputTxt').focus();
                return false;
            }
            msgBox.data('zf', msgBox.find('.inputTxt').val());
            $('.talk_pannel .replylist').remove();
            var commentPannel = $('<div class="replylist commentPannel"></div>').appendTo(msgBox), loading = '<div class="pub-loading_s1">正在加载...</div>';
            $('<div class="top"><a href="" class="w_close" title="点击关闭"><b class="close">关闭</b></a></div><div class="talkbox"><textarea class="inputTxt"></textarea><div class="funbox"><input type="button" class="pub-btn send_btn" tabindex="2" value="评论" /><span class="countTxt">还能输入<em>140</em>字</span></div></div>' + loading).appendTo(commentPannel);
            msgBox.find('.inputTxt').focus();
            if (msgBox.data('pl')) { msgBox.find('.inputTxt').val(msgBox.data('pl')) }
			countTxt(msgBox.find('.inputTxt'), msgBox.find('.countTxt'));
            msgBox.find('.pub-loading_s1').hide(); 
            var tempHtml = "1111111111111111111111";
            $('<div class="cont" id="comment_' + noteId + '">' + tempHtml + '</div>').appendTo(commentPannel);
            msgBox.find('.w_close').click(function () { commentPannel.remove(); $('.talk_pannel ul.message>li').removeClass('ac'); return false; });
            return false;
        });
        $('.talk_pannel .controlbar .zf').unbind('click').click(function () {//转发
            var msgBox = $(this).parents('.msgbox');
            var noteId = $(this).attr("noteId");
            if (msgBox.find('.transmitPannel')[0]) {
                msgBox.find('.inputTxt').focus();
                return false;
            }
            msgBox.data('pl', msgBox.find('.inputTxt').val());
            $('.talk_pannel .replylist').remove();
            var commentPannel = $('<div class="replylist transmitPannel"></div>').appendTo(msgBox), loading = '<div class="pub-loading_s1">正在加载...</div>';
            $('<div class="top"><a href="" class="w_close" title="点击关闭"><b class="close">关闭</b></a></div><div class="talkbox"><textarea class="inputTxt"></textarea><div class="funbox"><input type="button" class="pub-btn send_btn" tabindex="2" value="转发" /><span class="countTxt">还能输入<em>140</em>字</span></div></div>' + loading).appendTo(commentPannel);
            msgBox.find('.inputTxt').focus();
            if (msgBox.data('zf')) { msgBox.find('.inputTxt').val(msgBox.data('zf')) }
			countTxt(msgBox.find('.inputTxt'), msgBox.find('.countTxt'));
            msgBox.find('.pub-loading_s1').hide();
            var tempHtml = "22222222222222222222222";
            $('<div class="cont" id="Reply_' + noteId + '">' + tempHtml + '</div>').appendTo(commentPannel);
            msgBox.find('.w_close').click(function () { commentPannel.remove(); $('.talk_pannel ul.message>li').removeClass('ac'); return false; });
            return false;
        });